extends Control


var data = null

signal view(data)
signal edit(data)
signal delete(data)

const cache_text = ["否", "是"]
const space_text = ["", "室内", "室外", "洞穴"]

func _ready():
	pass 

func set_data(data):
	self.data = data
	
	var id = data["id"]
	$vbox/id.text = str(id)
	
	$vbox/name.text = data["name"]
	$vbox/name.hint_tooltip = data["path"]
	var cache = data.get("cache", 1)
	var space = data.get("space", 1)
	
	$vbox/cache.text = cache_text[cache]
	$vbox/space.text = space_text[space]
	


func _on_view_button_up():
	emit_signal("view", data)


func _on_edit_button_up():
	emit_signal("edit", data)


func _on_delete_button_up():
	emit_signal("delete", data)
